<template>
  <div class="search">
    <Card>
      <Form
        ref="searchForm"
        :model="searchForm"
        inline
        :label-width="70"
        class="search-form"
      >
        <Form-item label="时间" prop="createTime">
          <DatePicker
            v-model="selectDate"
            type="daterange"
            format="yyyy-MM-dd HH:mm:ss"
            clearable
            @on-change="selectDateRange"
            placeholder="选择起始时间"
            style="width: 200px"
          >
          </DatePicker>
        </Form-item>
        <Form-item label="手机号" prop="mobile">
          <Input
            type="text"
            v-model="searchForm.mobile"
            placeholder="请输入手机号"
            clearable
            style="width: 200px"
          />
        </Form-item>
        <Form-item label="区域" prop="region">
          <region style="width: 350px" @selected="selectedRegionSearch" />
        </Form-item>
        <Button
          @click="handleSearch"
          type="primary"
          icon="ios-search"
          class="search-btn"
          >搜索</Button
        >
        <Button class="search-btn" type="primary" @click="handleReset"
          >重置</Button
        >
      </Form>
      <Row class="operation padding-row">
      </Row>
      <Table
        :loading="loading"
        border
        :columns="columns"
        :data="data"
        ref="table"
      ></Table>
      <Row type="flex" justify="end" class="mt_10">
        <Page
          :current="searchForm.pageNumber"
          :total="total"
          :page-size="searchForm.pageSize"
          @on-change="changePage"
          @on-page-size-change="changePageSize"
          :page-size-opts="[10, 20, 50, 100]"
          size="small"
          show-total
          show-elevator
          show-sizer
        ></Page>
      </Row>
    </Card>
     <Modal width="1500px" v-model="bindModal" footer-hide title="已解绑名单" @on-ok="bindMemberData">
      <unBindMemberList ref="bindMember" ></unBindMemberList>
    </Modal>
  </div>
</template>

<script>
import region from "../seller/shop/region.vue";
import { getShopListData } from "@/api/shops";
import unBindMemberList from '@/views/abnormal-manager/components/unBindMemberList'
export default {
  name:'logoutManager',
  components: {
    region,
    unBindMemberList
  },
  data() {
    return {
      selectDate: null, // 选择一个时间段
      searchForm: {
        // 搜索框初始化对象
        pageNumber: 1, // 当前页数
        pageSize: 10, // 页面大小
        sort: "createTime", // 默认排序字段
        order: "desc", // 默认排序方式
        startDate: "", // 起始时间
        endDate: "", // 终止时间
        billStatus: "", //状态
        mobile: "", // 手机号
      },
      loading: false, // 表单加载状态
      total: 0, // 表单数据总数
      data: [
        {name:'1'}
      ], // 表单数据
      columns: [
        // 表头
        {
          title: "序号",
          type:'index'
        },
        {
          title: "会员昵称",
          key: "mobile",
          minWidth: 120,
          align: "left",
        },
        {
          title: "手机号",
          key: "mobile",
          minWidth: 120,
          align: "left",
        },
        {
          title: "姓名",
          key: "mobile",
          minWidth: 120,
          align: "left",
        },
        {
          title: "身份证号",
          key: "mobile",
          minWidth: 120,
          align: "left",
        },
        {
          title: "区域",
          key: "mobile",
          minWidth: 120,
          align: "left",
        },
        {
          title: "推广人手机号",
          key: "mobile",
          minWidth: 120,
          align: "left",
        },
        {
          title: "身份类型",
          key: "mobile",
          minWidth: 120,
          align: "left",
        },
        {
          title: "类型",
          key: "mobile",
          minWidth: 120,
          align: "left",
        },
        {
          title: "端口费焕贝额",
          key: "mobile",
          minWidth: 120,
          align: "left",
        },
        {
          title: "端口费现金额",
          key: "mobile",
          minWidth: 120,
          align: "left",
        },
        {
          title: "申请时间",
          key: "mobile",
          minWidth: 120,
          align: "left",
        },
        {
          title: "审核时间",
          key: "mobile",
          minWidth: 120,
          align: "left",
        },
        {
          title: "剩余焕贝总金额",
          key: "memberName",
          minWidth: 130,
          tooltip: true,
        },
        {
          title: "退回现金额",
          key: "memberName",
          minWidth: 130,
          tooltip: true,
        },
        {
          title: "收款人",
          key: "memberName",
          minWidth: 130,
          tooltip: true,
        },
        {
          title: "收款人电话",
          key: "memberName",
          minWidth: 130,
          tooltip: true,
        },
        {
          title: "解绑总人数",
          key: "memberName",
          minWidth: 130,
          tooltip: true,
        },
        {
          title: "解绑打款时间",
          key: "memberName",
          minWidth: 130,
          tooltip: true,
        },
        {
          title: "操作",
          key: "action",
          align: "center",
          width: 200,
          fixed: "right",
          render: (h, params) => {
            return h(
              "div",
              {
                style: {
                  display: "flex",
                  justifyContent: "center",
                },
              },
              [
                 h(
                  "Button",
                  {
                    props: {
                      size: "small",
                      type:  "primary",
                    },
                    style: {
                      marginRight: "5px",
                    },
                    on: {
                      click: () => {
                        this.bindMember(params.row, params.index);
                      },
                    },
                  },
                  "绑定会员"
                ),
              ]
            );
          },
        },
      ],
      
      bindModal:false//绑定会员弹框
    };
  },
  methods: {
     // 绑定会员
    bindMember(val){
      console.log(val)
      this.bindModal=true
    },
      // 获取绑定会员组件选中的会员数据
    bindMemberData(){
      //获取选中的数据数组
      // console.log(this.$refs.bindMember.choseDataList)
      // 获取选中的会员id数组  传给后端的参数名 choseBindMemberIds  
      // console.log(this.$refs.bindMember.choseIds,'7777777777777777777777777')
    },
    changePage(v) {
      // 改变页码
      this.searchForm.pageNumber = v;
      this.getDataList();
    },
    changePageSize(v) {
      // 改变页数
      this.searchForm.pageSize = v;
      this.getDataList();
    },
    selectDateRange(v) {
      if (v) {
        this.searchForm.startDate = v[0];
        this.searchForm.endDate = v[1];
      }
    },
    // 选中的地址
    selectedRegionSearch(val) {
      let ids = val[0];
      this.searchForm.regionId = ids[ids.length - 1];
      // this.searchForm.regionId = val[0][val[0].length - 1];
    },
    handleSearch() {
      this.searchForm.pageNumber = 1;
      this.searchForm.pageSize = 10;
      //   this.getDataList();
    },
    getDataList() {
      this.loading = true;
      // 带多条件搜索参数获取表单数据 请自行修改接口
      getShopListData(this.searchForm).then((res) => {
        this.loading = false;
        if (res.success) {
          this.data = res.result.records;
          this.total = res.result.total;
        }
      });
      this.total = this.data.length;
      this.loading = false;
    },
    // 重置
    handleReset() {
      this.searchForm.pageNumber = 1;
      this.searchForm.pageSize = 10;
      (this.searchForm.region = ""), (this.searchForm.mobile = "");
      this.searchForm.createTime = "";
      console.log(this.searchForm);
      //   this.getData();
    },
  },
};
</script>

<style>
</style>